package com.tanhua.dubbo.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tanhua.domain.db.Log;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

public interface LogMapper extends BaseMapper<Log> {

    @Select("select count( DISTINCT user_id   ) as num from tb_log where log_time=#{todayStr} and type=#{type} ")
    Integer queryNumRegisteredOrLogin(@Param("todayStr") String todayStr,@Param("type") String type);

    @Select("select count( DISTINCT user_id   ) as num from tb_log where log_time=#{todayStr}  ")
    Integer queryNumActive(String todayStr);

    @Select(" select  count( DISTINCT user_id   ) as num  from tb_log where log_time=#{todayStr} and  user_id in  " +
            "  (select  DISTINCT user_id   from tb_log where log_time=#{yestodyStr} and type='0102' ) ")
    Integer queryNumRetention1d(@Param("todayStr") String todayStr,@Param("yestodyStr") String yestodyStr);
}
